//
//  UIView+Util.m
//  YiShou
//
//  Created by Kerry on 16/3/9.
//  Copyright © 2016年 FuMi. All rights reserved.
//

#import "UIView+Util.h"

@implementation UIView (Util)

- (void)configLayerWithBorderWidth:(CGFloat)width andWithCornerRadius:(CGFloat)radius andWithBorderColor:(UIColor *)color
{
    self.layer.borderWidth = width;
    self.layer.cornerRadius = radius;
    [self.layer setMasksToBounds:YES];
    if (color) {
        self.layer.borderColor = color.CGColor;
    }
}

- (void)keyboardCanHide
{
    UITapGestureRecognizer *tapGestureRecognizer = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(keyboardHide)];
    //设置成NO表示当前控件响应后会传播到其他控件上，默认为YES。
    //    tapGestureRecognizer.cancelsTouchesInView = NO;
    [self addGestureRecognizer:tapGestureRecognizer];
}

- (void)keyboardHide
{
    [self endEditing:YES];
}

- (void)circularCorner
{
    self.layer.cornerRadius = self.lzs_height / 2.0;
    self.layer.masksToBounds = YES;
}

- (void)circularCorner:(CGFloat)cornerRadius
{
    self.layer.cornerRadius = cornerRadius;
    self.layer.masksToBounds = YES;
}


@end
